/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package battleshipgame.ui;

import battleshipgame.logic.Player;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 *
 * @author dunay
 */
public class timeoutPlayerListener implements HttpSessionListener{

    public void sessionCreated(HttpSessionEvent se) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void sessionDestroyed(HttpSessionEvent se) {
        if (se.getSession().getAttribute("userPlayer") != null)
        {
            Player player = (Player)se.getSession().getAttribute("userPlayer");
            player.withdraw();
        }
        //throw new UnsupportedOperationException("Not supported yet.");
    }

}
